From 4ca26972714e9750bcf38fd47ac841aaba6cb714 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 23 Aug 2012 22:37:50 -0300 Subject: [PATCH] shellDBus: Fix reloadExtension We need to recreate and reimport the extension here, not just reimport the same exact code. https://bugzilla.gnome.org/show_bug.cgi?id=682578 --- js/ui/extensionSystem.js | 13 +++++++++++++ js/ui/shellDBus.js | 7 +++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js index ac4acbb73..4eb49c10f 100644 --- a/js/ui/extensionSystem.js +++ b/js/ui/extensionSystem.js @@ -171,6 +171,19 @@ function unloadExtension(extension) { return true; } +function reloadExtension(oldExtension) { + // Grab the things we'll need to pass to createExtensionObject + // to reload it. + let { uuid: uuid, dir: dir, type: type } = oldExtension; + + // Then unload the old extension. + unloadExtension(oldExtension); + + // Now, recreate the extension and load it. + let newExtension = ExtensionUtils.createExtensionObject(uuid, dir, type); + loadExtension(newExtension); +} + function initExtension(uuid) { let extension = ExtensionUtils.extensions[uuid]; let dir = extension.dir; diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js index 53a6523c2..78aebab16 100644 --- a/js/ui/shellDBus.js +++ b/js/ui/shellDBus.js @@ -318,8 +318,11 @@ const GnomeShellExtensions = new Lang.Class({ }, ReloadExtension: function(uuid) { - ExtensionSystem.unloadExtension(uuid); - ExtensionSystem.loadExtension(uuid); + let extension = ExtensionUtils.extensions[uuid]; + if (!extension) + return; + + ExtensionSystem.reloadExtension(extension); }, CheckForUpdates: function() { -- 2.39.5